package cn.lyd.base.enm;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

@Getter
@AllArgsConstructor
public enum EmpStateEnum {
    //员工状态：0禁用，1启用
    ACTIVITY_NO_PASS(0,"禁用"),
    ACTIVITY(1,"启用");


    public static String getNameByCode(Integer code){
        Optional<EmpStateEnum> first = Arrays.stream(EmpStateEnum.values()).filter(state -> state.getCode() == code)
                .findFirst();
        return first.isPresent()?first.get().getName():"";
    }

    private int code;

    private String name;
}
